<template>
  <!-- 待办 -->
  <div class="card">
    <div class="card-top flex justify-between">
      <div class="flex">
        <template v-for="(item, index) in menuList" :key="index">
          <el-badge class="item" :value="item.num" :offset="[-25, 5]">
            <div
              class="card-top-menu"
              :class="activeMenuID === item.id ? 'card-top-menu-active' : ''"
              @click="handleClickTopMenu(item)"
            >
              {{ item.name }}
            </div>
          </el-badge>
        </template>
      </div>
      <el-button type="primary" text="text" class="btn-more"
        >更多<van-icon name="arrow" class="ml-[5px]"
      /></el-button>
    </div>
    <el-divider />
    <div class="card-bottom">
      <div
        v-for="(item, index) in dataList"
        :key="index"
        class="flex justify-between mb-[20px]"
      >
        <div class="w-[400px]">
          <el-tag :type="item.type">{{ item.typeName }}</el-tag>
          <el-link href="" target="" class="ml-[10px]">{{
            item.title
          }}</el-link>
        </div>
        <div class="gray w-[150px]">申请人：{{ item.people }}</div>
        <div class="gray">到达时间：{{ item.date }}</div>
      </div>
    </div>
  </div>
</template>
<script setup lang="ts">
import { ref, reactive } from "vue";
import { useRouter } from "vue-router";
let activeMenuID = ref(1);
const menuList = reactive([
  { id: 1, name: "我的待办", num: 1000 },
  { id: 2, name: "抄送我的", num: 4 },
  { id: 3, name: "我的已办", num: 0 },
  { id: 4, name: "我的申请", num: 0 }
]);
const dataList = reactive([
  {
    type: "danger",
    typeName: "教务系统",
    title: "就读证明申请-郝开",
    people: "郝开",
    date: "2025-08-06 16:36"
  },
  {
    type: "danger",
    typeName: "教务系统",
    title: "就读证明申请-任慧",
    people: "任慧",
    date: "2025-08-04 13:46"
  },
  {
    type: "danger",
    typeName: "教务系统",
    title: "免考/缓考申请-缓考申请-晏腾飞",
    people: "晏腾飞",
    date: "2025-07-16 09:51"
  },
  {
    type: "danger",
    typeName: "教务系统",
    title: "学籍异动-转专业-曾静怡",
    people: "曾静怡",
    date: "2025-07-15 14:13"
  },
  {
    type: "danger",
    typeName: "教务系统",
    title: "免考/缓考申请-缓考申请-晏腾飞",
    people: "晏腾飞",
    date: "2025-07-14 17:52"
  },
  {
    type: "danger",
    typeName: "教务系统",
    title: "免考/缓考申请-缓考申请-晏腾飞",
    people: "晏腾飞",
    date: "2025-07-14 17:05"
  }
]);
const handleClickTopMenu = item => {
  activeMenuID.value = item.id;
  router.push({ path: item.url });
};
</script>

<style lang="less" scoped>
.el-link {
  //   font-size: 16px;
  color: var(--color-main-text-secondary);
  &:hover {
    color: var(--el-color-primary);
  }
}
.gray {
  color: var(--color-main-text);
}
.btn-more {
  color: #73665b;
}
</style>
